package plataforma.cih;

import nucleo.global.ContextoSessao;

import org.zkoss.zk.ui.SuspendNotAllowedException;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Vlayout;
import org.zkoss.zul.Window;

public abstract class JanelaModalSimples extends Window {

	Vlayout conteudo = new Vlayout();

	public JanelaModalSimples() {

		setHeight("400px");
		setWidth("400px");

		setClosable(true);
		conteudo.setParent(this);

		this.appendChild(new Separator());

	}

	public abstract Vlayout getConteudo();

	public void setConteudo(Vlayout conteudo) {
		this.conteudo = conteudo;
	}

	public abstract void configurarComponentes();

	public void mostrarJanela() {
		try {

			ContextoSessao.getCtrlPrincipal().getJanPrincipal()
					.appendChild(this);
			this.appendChild(new Separator());

			configurarComponentes();

			this.appendChild(getConteudo());

			doModal();
		} catch (SuspendNotAllowedException e) {

			e.printStackTrace();
		} catch (InterruptedException e) {

			e.printStackTrace();
		}

	}

}
